<h1><%= "#{t(:listing)} #{t(:prescriptions)}" %></h1>

<table>
  <thead>
    <tr>
      <th><%= t :drug %></th>
      <th><%= t :appointment %></th>
      <th><%= t :dosage %></th>
      <th><%= t :quantity %></th>
      <th><%= t :fee %></th>
      <th><%= t :note %></th>
      <th colspan="3"></th>
    </tr>
  </thead>

  <tbody>
    <% @prescriptions.each do |prescription| %>
      <tr>
        <% prescription.drugs.each do |d| %>
        	<td><%= d.name %></td>
        <% end %>
        <td><%= prescription.appointment_id %></td>
        <td><%= prescription.dosage %></td>
        <td><%= prescription.quantity %></td>
        <td><%= prescription.fee %></td>
        <td><%= prescription.note %></td>
        <td><%= link_to "#{t(:show)}", prescription %></td>
        <td><%= link_to "#{t(:edit)}", edit_prescription_path(prescription) %></td>
        <td><%= link_to "#{t(:destroy)}", prescription, method: :delete, data: { confirm: 'Are you sure?' } %></td>
      </tr>
    <% end %>
  </tbody>
</table>

<br>

<%= link_to "#{t(:new_prescription)}", new_prescription_path %>
